From 3c559031623649a67825ff47f34512f0eb946861 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 10:14:32 +0700
Subject: fix

---
 src/pages/my/address/[id]/edit.jsx | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 src/pages/my/address/[id]/edit.jsx

(limited to 'src/pages/my/address/[id]/edit.jsx')

diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx
new file mode 100644
index 00000000..feff85fd
--- /dev/null
+++ b/src/pages/my/address/[id]/edit.jsx
@@ -0,0 +1,30 @@
+import AppLayout from "@/core/components/layouts/AppLayout"
+import addressApi from "@/lib/address/api/addressApi"
+import EditAddressComponent from "@/lib/address/components/EditAddress"
+
+export default function EditAddress({ id, defaultValues }) {
+  return (
+    <AppLayout title="Ubah Alamat">
+      <EditAddressComponent id={id} defaultValues={defaultValues} />
+    </AppLayout>
+  )
+}
+
+export async function getServerSideProps(context) {
+  const { id } = context.query
+  const address = await addressApi({ id })
+  const defaultValues = {
+    type: address.type,
+    name: address.name,
+    email: address.email,
+    mobile: address.mobile,
+    street: address.street,
+    zip: address.zip,
+    city: address.city?.id || "",
+    oldDistrict: address.district?.id || "",
+    district: "",
+    oldSubDistrict: address.subDistrict?.id || "",
+    subDistrict: "",
+  }
+  return { props: { id, defaultValues } }
+}
-- 
cgit v1.2.3


From f66b12fd1d0b83af0d7230d7b1565fbe00afbe3c Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 11:03:34 +0700
Subject: prettier

---
 src/pages/my/address/[id]/edit.jsx | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'src/pages/my/address/[id]/edit.jsx')

diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx
index feff85fd..a7c22147 100644
--- a/src/pages/my/address/[id]/edit.jsx
+++ b/src/pages/my/address/[id]/edit.jsx
@@ -1,10 +1,10 @@
-import AppLayout from "@/core/components/layouts/AppLayout"
-import addressApi from "@/lib/address/api/addressApi"
-import EditAddressComponent from "@/lib/address/components/EditAddress"
+import AppLayout from '@/core/components/layouts/AppLayout'
+import addressApi from '@/lib/address/api/addressApi'
+import EditAddressComponent from '@/lib/address/components/EditAddress'
 
 export default function EditAddress({ id, defaultValues }) {
   return (
-    <AppLayout title="Ubah Alamat">
+    <AppLayout title='Ubah Alamat'>
       <EditAddressComponent id={id} defaultValues={defaultValues} />
     </AppLayout>
   )
@@ -20,11 +20,11 @@ export async function getServerSideProps(context) {
     mobile: address.mobile,
     street: address.street,
     zip: address.zip,
-    city: address.city?.id || "",
-    oldDistrict: address.district?.id || "",
-    district: "",
-    oldSubDistrict: address.subDistrict?.id || "",
-    subDistrict: "",
+    city: address.city?.id || '',
+    oldDistrict: address.district?.id || '',
+    district: '',
+    oldSubDistrict: address.subDistrict?.id || '',
+    subDistrict: ''
   }
   return { props: { id, defaultValues } }
 }
-- 
cgit v1.2.3


From ac3fdf7be9982e65d8f83a20bc487f8dd62e3bfc Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Wed, 22 Feb 2023 23:36:47 +0700
Subject: fix

---
 src/pages/my/address/[id]/edit.jsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/pages/my/address/[id]/edit.jsx')

diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx
index a7c22147..65d7cf9b 100644
--- a/src/pages/my/address/[id]/edit.jsx
+++ b/src/pages/my/address/[id]/edit.jsx
@@ -5,7 +5,10 @@ import EditAddressComponent from '@/lib/address/components/EditAddress'
 export default function EditAddress({ id, defaultValues }) {
   return (
     <AppLayout title='Ubah Alamat'>
-      <EditAddressComponent id={id} defaultValues={defaultValues} />
+      <EditAddressComponent
+        id={id}
+        defaultValues={defaultValues}
+      />
     </AppLayout>
   )
 }
-- 
cgit v1.2.3


From ffa261e6adef70a2845878cf93e6e492eb8cee62 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Mon, 27 Feb 2023 10:49:45 +0700
Subject: footer

---
 src/pages/my/address/[id]/edit.jsx | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

(limited to 'src/pages/my/address/[id]/edit.jsx')

diff --git a/src/pages/my/address/[id]/edit.jsx b/src/pages/my/address/[id]/edit.jsx
index 65d7cf9b..bc5f3471 100644
--- a/src/pages/my/address/[id]/edit.jsx
+++ b/src/pages/my/address/[id]/edit.jsx
@@ -1,15 +1,18 @@
 import AppLayout from '@/core/components/layouts/AppLayout'
 import addressApi from '@/lib/address/api/addressApi'
 import EditAddressComponent from '@/lib/address/components/EditAddress'
+import IsAuth from '@/lib/auth/components/IsAuth'
 
 export default function EditAddress({ id, defaultValues }) {
   return (
-    <AppLayout title='Ubah Alamat'>
-      <EditAddressComponent
-        id={id}
-        defaultValues={defaultValues}
-      />
-    </AppLayout>
+    <IsAuth>
+      <AppLayout title='Ubah Alamat'>
+        <EditAddressComponent
+          id={id}
+          defaultValues={defaultValues}
+        />
+      </AppLayout>
+    </IsAuth>
   )
 }
 
-- 
cgit v1.2.3

